package com.szdvte.news.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.szdvte.news.bean.Comments;
import com.szdvte.news.dao.ICommentsDao;
import com.szdvte.news.service.ICommentsService;
import com.szdvte.news.util.WiterUtil;

public class CommentsServiceImpl implements ICommentsService {
	private ICommentsDao commentsDao;
	@Override
	public List<Comments> selectComments(Comments comments) {
		return commentsDao.selectComments(comments);
	}

	@Override
	public boolean add(Comments comments) {
		return commentsDao.add(comments);
	}
	public ICommentsDao getCommentsDao() {
		return commentsDao;
	}
	public void setCommentsDao(ICommentsDao commentsDao) {
		this.commentsDao = commentsDao;
	}

	@Override
	public List<Comments> selectAll() {
		List<Comments> list = new ArrayList<Comments>();
		List<Comments> list1 = commentsDao.selectAll(new Comments());
		for(Comments comments:list1){
			comments.setCommentsParserData(WiterUtil.parseData(comments.getCommentsData()));
			list.add(comments);
		}
		return list;
	}

}
